pub mod adb;
pub mod manager;
pub mod monitoring;
pub mod control;
pub mod protocol;
pub mod scrcpy;

pub use adb::{AdbManager, AdbError};
pub use manager::{DeviceManager, DeviceEvent, DeviceHealth};
pub use monitoring::{DeviceMonitoringService, MonitoringEvent, MonitoringConfig};
pub use control::{ControlMsgType, ControlMessage, ControlHandler, ControlEvent};
pub use scrcpy::{ScrcpyServer, ScrcpyClient, ScrcpySocket};

use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};

/// 设备连接类型
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ConnectionType {
    Usb,
    Network { ip: String, port: u16 },
}

/// 设备平台类型
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Platform {
    Android,
    #[allow(non_camel_case_types)]
    iOS,
}

/// 设备状态
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum DeviceStatus {
    Online,
    Offline,
    Connecting,
    Busy,
    Error(String),
}

/// 设备信息
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeviceInfo {
    pub id: String,
    pub name: String,
    pub platform: Platform,
    pub connection_type: ConnectionType,
    pub status: DeviceStatus,
    pub system_info: Option<SystemInfo>,
    pub last_heartbeat: Option<DateTime<Utc>>,
}

/// 系统信息
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SystemInfo {
    pub model: String,
    pub version: String,
    pub resolution: String,
    pub memory: String,
    pub storage: String,
    pub cpu: String,
    pub network: Option<NetworkInfo>,
}

/// 网络信息
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetworkInfo {
    pub ip_address: String,
    pub network_type: String,
    pub carrier: Option<String>,
}

/// 设备性能指标
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerformanceMetrics {
    pub cpu_usage: f32,
    pub memory_usage: f32,
    pub battery_level: Option<f32>,
    pub temperature: Option<f32>,
    pub network_speed: Option<f32>,
}